#pragma once
#include "afxwin.h"
#include "afxcmn.h"

#include "ModelLayerView.h"

#include "ColoredListCtrl.h"
// CFindConnectorDlg dialog

class CFindConnectorDlg : public CDialogEx
{
	DECLARE_DYNAMIC(CFindConnectorDlg)

public:
	CFindConnectorDlg(CModelLayerView* pView, CWnd* pParent = NULL);
	virtual ~CFindConnectorDlg();

// Dialog Data
	enum { IDD = IDD_FIND_CONNECTOR };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual BOOL OnInitDialog();
	virtual BOOL PreTranslateMessage(MSG* pMsg);

	DECLARE_MESSAGE_MAP()

public:
	afx_msg void OnBnClickedCheckConnectorName();
	afx_msg void OnBnClickedCheckConnectorCode();
	afx_msg void OnBnClickedCheckConnectorTypeNo();
	afx_msg void OnBnClickedCheckConnectType();
	afx_msg void OnBnClickedButtonFindConnector();
	afx_msg void OnBnClickedButtonSelectAll();
	afx_msg void OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	
	afx_msg void OnOK();
	afx_msg void OnCancel();
	afx_msg void OnClose();
	afx_msg void OnDestroy();
	afx_msg void OnBnClickedFindAbnormalConnector();
	afx_msg void OnBnClickedFindInAllCheck();
	//virtual void OnOK();
private:
	void CompareName(std::list<CConnector*>& listConnector);
	void CompareCode(std::list<CConnector*>& listConnector);
	void CompareTypeNo(std::list<CConnector*>& listConnector);
	void CompareConnectType(std::list<CConnector*>& listConnector);
	void HighlightSelected(std::list<CConnector*>& listSelected,bool bShowProp=true);
	void ListSelection();

	void ReportResult();

private:
	CSystem* m_pBigDrawing;
	std::list<CConnector*> m_listResult;

	CModelLayerView* m_pView;
	HICON m_hIcon;

	CButton m_buttonConName;
	CButton m_buttonConCode;
	CButton m_buttonConTypeNo;
	CButton m_buttonConnectType;

	CEdit m_editConName;
	CEdit m_editConCode;
	CEdit m_editConTypeNo;
	CComboBox m_comboConnectType;

	CColoredListCtrl m_List;
	BOOL m_bFindInAllData;

	CEdit m_FusszEdit;
	CString m_szEditFussz;
	CToolTipCtrl m_tooltip;
public:
	void FuzzySearch();
	void EnableFusszSearchEdit();
	bool FindByKeyword(list<CString> lstString, CString szFindName) const;
};
